package cn.com.graPro.controller;

import cn.com.graPro.service.AuthService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/getAuth")
public class GetAuthController {

	private static final Logger LOG = LoggerFactory.getLogger(GetAuthController.class);
	// 设置APPID/AK/SK
	public static final String APP_ID = "15668388";
	public static final String API_KEY = "SF9CASgufhEcG50a6TIKkcKT";
	public static final String SECRET_KEY = "VlSWP9dWtiuT1WMflnEngaxvQLKHu0Mh";

	@RequestMapping(value = "/getAuth", method = RequestMethod.GET)
	@ResponseBody
	public String getAuth(@PathVariable String client_id, @PathVariable String client_secret) {
		LOG.info("getAuth({},{})", client_id, client_secret);
		String token = AuthService.getAuth(client_id, client_secret);
		return token;
	}

	@RequestMapping(value = "/getAuth2", method = RequestMethod.GET)
	@ResponseBody
	public String getAuth2() {
		LOG.info("getAuth2()");
		String token = AuthService.getAuth();
		return token;
	}

}